home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Developer Utilities / Installer 4.0.3 SDK / Script Examples / Action Atoms [inaa] Example / myActionAtoms.r < prev    next >
Encoding:
Text File  |  1994-11-15  |  7.4 KB  |  278 lines  |  [TEXT/MPS ]

  1. //
  2. //    myActionAtoms.r
  3. //
  4. //        Purpose : Demonstrate use of the three types of action atoms.
  5. //
  6. //        There are four selectable packages in Custom Install. Each
  7. //        package calls one of the three formats of action atoms. Each
  8. //        action atom will be called before install, and will not be 
  9. //        called at all when performing a custom remove.
  10. //
  11. //        A dialog is provided that will allow the user to choose which
  12. //        value should be returned from the current action atom.
  13. //
  14. //        The third Custom Install option includes Installer Debugger
  15. //        example code within the action atom to display status and
  16. //        progress information to the Installer Debugger during execution
  17. //        of the action atom. To observe this feature, drag drop a copy
  18. //        of the debugger version of the installer script onto a copy of
  19. //        the installer application that contains the Wasabi Installer 
  20. //        Debugger.
  21. //
  22. //        The fourth option calls an action atom that displays progress
  23. //        in the Installer dialog progress bar while the action atom is
  24. //        running.
  25. //
  26. //        NOTE: A file atom has been included with each action
  27. //        atom in the three packages. Action atoms can, however,
  28. //        be included in packages by themselves. 
  29. //
  30. //
  31. //        mark young • 08/25/94 
  32. //    
  33. //        Copyright 1993-1994, Apple Computer, Inc., All Rights Reserved
  34. //
  35.  
  36. #include "InstallerTypes.r"
  37.  
  38. // custom install framework always uses ID of 766
  39. resource 'infr' (766) {
  40.     format0 {{
  41.         pickFirst, { 700 },            // adds TeachText to custom install options
  42.     }}
  43. };
  44.  
  45. // • rules
  46.  
  47. // rule that adds package with the subpackages
  48. resource 'inrl' (700) {
  49.     format0 {{
  50.         AddCustomItems{{ 100,200,300,400 }},
  51.     }}
  52. };
  53.  
  54.  
  55. // • packages
  56.  
  57. resource 'inpk' (100) {
  58.     format0 {
  59.         showsOnCustom,
  60.         removable,
  61.         dontForceRestart,
  62.         0,
  63.         0,
  64.         "Run action atom format 0 - with TeachText",
  65.         {    
  66.         'infa', 1000;
  67.         'inaa', 9000;
  68.         },
  69.     }
  70. };
  71.  
  72. resource 'inpk' (200) {
  73.     format0 {
  74.         showsOnCustom,
  75.         removable,
  76.         dontForceRestart,
  77.         0,
  78.         0,
  79.         "Run action atom format 1 - with TeachText",
  80.         {    
  81.         'infa', 1000;
  82.         'inaa', 9001;
  83.         },
  84.     }
  85. };
  86.  
  87. resource 'inpk' (300) {
  88.     format0 {
  89.         showsOnCustom,
  90.         removable,
  91.         dontForceRestart,
  92.         0,
  93.         0,
  94.         "Run action atom format 2 - with TeachText",
  95.         {    
  96.         'infa', 1000;
  97.         'inaa', 9002;
  98.         },
  99.     }
  100. };
  101.  
  102. resource 'inpk' (400) {
  103.     format0 {
  104.         showsOnCustom,
  105.         removable,
  106.         dontForceRestart,
  107.         0,
  108.         0,
  109.         "Progress Bar action atom ( format2 ) - with TeachText",
  110.         {    
  111.         'infa', 1000;
  112.         'inaa', 9003;
  113.         },
  114.     }
  115. };
  116.  
  117.  
  118.  
  119. // • file atoms
  120.  
  121. // file atom for TeachText ( same file atom used for all packages )
  122. resource 'infa' (1000) {
  123.     format1 {
  124.         deleteWhenRemoving,            // Delete existing file on remove
  125.         deleteWhenInstalling,        // Delete existing file on install
  126.         copy,                        // Copy on Install
  127.         dontIgnoreLockedFile,        // Respect file locking
  128.         dontSetFileLocked,            // Don't lock installed file
  129.         useSrcCrDateToCompare,        // Use date for comparisons
  130.         srcNeedExist,                // Never create new file ( update only )
  131.         rsrcForkInRsrcFork,            // Put resources in resource fork
  132.         leaveAloneIfNewer,            // Do not update a newer file
  133.         updateExisting,                // Update an existing file
  134.         copyIfNewOrUpdate,            // Copy whether it preexists or not
  135.         rsrcFork,                    // Copy or Remove resource fork
  136.         dataFork,                    // Copy or Remove data fork
  137.         0,                            // File size            
  138.         0x0,                        // File Finder attributes
  139.         11001,                        // Target spec ( 'intf' )
  140.         {    
  141.             11000,                     // Source spec ( 'infs' )
  142.             0,                         // Data fork size
  143.             0                        // Resource fork size
  144.         },
  145.         0,                            // Source version number in BCD format
  146.         0,                            // Version compare resource ID
  147.         0,                            // Atom extender resource ID
  148.         "TeachText"                    // Atom description
  149.     }
  150. };
  151.  
  152.  
  153. // • file specs
  154.  
  155. // target file spec for teach text application
  156. resource 'intf' (11001) {
  157.     format1 {
  158.         noSearchForFile,                 // use default search path
  159.         
  160.         TypeCrMustMatch,                 // If this is set to TypeCrMustMatch
  161.                                         // then a file with a different type
  162.                                         // and creator will not be replaced.
  163.                                         // If this is set to TypeCrNeedNotMatch
  164.                                         // then type and creator of an existing
  165.                                         // target file are ignored.
  166.         
  167.         // The Type and Creator fields will be used to set the
  168.         // file's Type and Creator when a new file is created. 
  169.         'APPL',                         // TYPE for new file
  170.         'ttxt',                         // CREATOR for new file
  171.         
  172.         0,                                 // finder attribute flags
  173.                                         // filled by ScriptCheck is value is 0
  174.         
  175.         1,                                  // creation date for new file
  176.         1,                                  // modification date for new file
  177.                                         // NOTE: DATE values are filled
  178.                                         // by ScriptCheck if the value is 1
  179.                                             
  180.         0,                                 // search proc ID ( 'insp' ), none used
  181.         
  182.         ":ActionAtom Example:TeachText"    // path to target file
  183.         }
  184.     };
  185.  
  186. // source file spec for teach text application
  187. resource 'infs' (11000) {
  188.     'APPL',                        // TYPE for source file
  189.     'ttxt',                        // CREATOR for source file
  190.     0x1,                        // creation DATE for source file
  191.     noSearchForFile,            // IGNORED in Installer 4.0.x
  192.     TypeCrMustMatch,            // TYPE, CREATOR must match file on install disk
  193.     "Disk 1:TeachText"            // PATH to source file        
  194. };
  195.  
  196.  
  197. // • action atoms
  198.  
  199. // format0 action atom
  200. include "myActionAtom_0.rsrc";
  201.  
  202. // format1 action atom
  203. include "myActionAtom_1.rsrc";
  204.  
  205. // format2 action atom
  206. include "myActionAtom_2.rsrc";
  207.  
  208. // format2 action atom
  209. include "ProgressAtom.rsrc";
  210.  
  211. resource 'inaa' ( 9000 ) {
  212.     format0{
  213.         actBefore,                // when to run action atom
  214.         dontActOnRemove,        // run action atom on removal
  215.         actOnInstall,            // run action atom on install
  216.         'infn',                    // resource type of code resource
  217.         9000,                    // resource ID of code resource
  218.         0,                        // refcon ID
  219.         "action atom format 0"    // description of atom
  220.     }
  221. };
  222.  
  223. resource 'inaa' ( 9001 ) {
  224.     format1{
  225.         suspendBusyCursors,        // how to handle cursor during atom
  226.         actBefore,                // when to run action atom
  227.         dontActOnRemove,        // run action atom on removal
  228.         actOnInstall,            // run action atom on install
  229.         'infn',                    // resource type of code resource
  230.         9001,                    // resource ID of code resource
  231.         1,                        // refcon ID
  232.         "action atom format 1"    // description of atom
  233.     }
  234. };
  235.  
  236. resource 'inaa' ( 9002 ) {
  237.     format2{
  238.         suspendBusyCursors,        // how to handle cursor during atom
  239.         actBefore,                // when to run action atom
  240.         dontActOnRemove,        // run action atom on removal
  241.         actOnInstall,            // run action atom on install
  242.         'infn',                    // resource type of code resource
  243.         9002,                    // resource ID of code resource
  244.         2,                        // refcon ID
  245.         
  246.         // NOTE: Enter zero for this value to use the installer's heap,
  247.         // or enter size in bytes to have this action atom use it's own heap.
  248.         // All earlier action atom formats use the installer's heap.
  249.         // IMPORTANT: enter zero for this field unless you have a specific
  250.         // reason for your action atom to use memory from it's own heap.
  251.         0,                        // requested memory in bytes
  252.                 
  253.         
  254.         "action atom format 2"    // description of atom
  255.     }
  256. };
  257.  
  258. resource 'inaa' ( 9003 ) {
  259.     format2{
  260.         suspendBusyCursors,        // how to handle cursor during atom
  261.         actBefore,                // when to run action atom
  262.         dontActOnRemove,        // run action atom on removal
  263.         actOnInstall,            // run action atom on install
  264.         'infn',                    // resource type of code resource
  265.         9003,                    // resource ID of code resource
  266.         3,                        // refcon ID
  267.         
  268.         // NOTE: Enter zero for this value to use the installer's heap,
  269.         // or enter size in bytes to have this action atom use it's own heap.
  270.         // All earlier action atom formats use the installer's heap.
  271.         // IMPORTANT: enter zero for this field unless you have a specific
  272.         // reason for your action atom to use memory from it's own heap.
  273.         0,                        // requested memory in bytes
  274.                 
  275.         
  276.         "progress bar action atom"    // description of atom
  277.     }
  278. };